<template>
  <div class="success-container">
    <h1>支付成功！</h1>
    <p v-if="outTradeNo">订单号：{{ outTradeNo }}</p>
    <p v-else>未检测到订单号</p>
    <button @click="goHome">返回购物车</button>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router';

const router = useRouter();
const outTradeNo = router.currentRoute.value.query.out_trade_no;

const goHome = () => {
  router.push('/shopcart');
};
</script>

<style scoped>
.success-container {
  max-width: 500px;
  margin: 2rem auto;
  padding: 2rem;
  text-align: center;
  border: 1px solid #eee;
  border-radius: 8px;
}
button {
  background-color: #1677ff;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 1rem;
}
</style>